#pragma once
#include <fcntl.h>
#include <string>
#include <vector>
#include <map>
#include <sys/stat.h>
#ifdef _WIN32
#include <Windows.h>
#include <WinBase.h>
#include <direct.h>
#include <io.h>
#include <time.h>
#define lseek _lseeki64
#define fstat _fstat64
#define stat  _stat64
#else
#include <dirent.h>
#include <sys/io.h>
#include <sys/mman.h>
#include <sys/unistd.h>
#include <sys/time.h>
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define __USE_FILE_OFFSET64
#endif

namespace Inverted_File_Index_2_1_0
{
	int ListSubDir(const char* RootDir, std::vector<std::string>& subDirs);

	void CreateDir(const char* dirPath);

	void RemoveDir(const char* dirPath);

	std::string CreateNameByTime(const char* rootPath);

	inline bool dirExist(const char* path)
	{
		return access(path, 0) == 0;
	}

	inline bool fileRead(const char* path)
	{
		return access(path, 0|4) == 0;
	}

	inline bool fileWrite(const char* path)
	{
		return access(path, 0|2) == 0;
	}
};